<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>团购商城_我的订单</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <script src="${pageContext.request.contextPath}/resources/js/jquery.min.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/footer.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/title.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/Order.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/font-awesome-4.7.0/css/font-awesome.min.css">
</head>
<body>
<header>
    <h1 class='title'>
        <a href="javascript:history.go(-1)"style="font-size: 1.9em;" target="_self"   class="fa fa-angle-left "></a>
        团购商城</h1>
</header>
<nav class="topnav">
    <ul class="topul">
        <li><a class="select" href="###">我的订单</a></li>
    </ul>
</nav>

<div class="centerul">
    <ul>

        <c:forEach items="${orderList}" var="order">
            <li >
                <div class="img"  onclick=turnHref('${pageContext.request.contextPath}/login-user/group?groupId='+"${order.groupId}")
                     style="background: url('${pageContext.request.contextPath}/resources/images/ ${order.group.imgAddress}')no-repeat 50% 50%;background-size: 120%;">
                </div>
                <div class="cen">
                    <p  onclick=turnHref('${pageContext.request.contextPath}/login-user/group?groupId='+"${order.groupId}")>${order.group.groupTitle}</p>

                    <div>
                        <span  onclick=turnHref('${pageContext.request.contextPath}/login-user/group?groupId='+"${order.groupId}") class="price fl">￥${order.group.price}</span>
                        <button class="Pending" <c:if test="${order.orderState eq 1}"> onclick="fetchToPay('${order.orderId}')</c:if>">

                            <c:if test="${order.orderState eq 2}">已付款</c:if>
                            <c:if test="${order.orderState eq 1}">未付款</c:if>
                        </button>
                    </div>
                </div>
            </li>
        </c:forEach>


    </ul>
</div>


<!--底部的三个按钮-->
<ul class="footer">
    <a href="${pageContext.request.contextPath}/login-user/index" target="_self">
        <li><span class="fa fa-home "></span><br>

            <p>首页</p></li>
    </a>
    <a href="  ${pageContext.request.contextPath}/login-user/my-group-list" target="_self">
        <li><span class="fa fa-user-circle-o "></span><br>

            <p>我的团</p></li>
    </a>
    <a class="footerselect" href="${pageContext.request.contextPath}/login-user/my-order-list" target="_self">
        <li><span class="fa fa-cart-plus "></span><br>

            <p>订单</p></li>
    </a>
</ul>

</body>
<script>
    function fetchToPay(orderId){
        $.ajax({
            url: "${ pageContext.request.contextPath}/login-user/order-set?orderId=" + orderId,
            type: 'get',
            dataType: 'text',
            timeout: 1000,
            cache: false,
            success: function (tt) {
                alert(tt);
                window.location.reload();
            }
        });
    }
</script>
<script src="${pageContext.request.contextPath}/resources/js/footer.js"></script>
<script src="${pageContext.request.contextPath}/resources/js/public.js"></script>
</html>